<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page   contentType="text/html;charset=UTF-8" language="java" %>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" />
		<link rel="stylesheet" href="<%=path%>/css/Site.css" />
		<link rel="stylesheet" href="<%=path%>/css/zy.all.css" />
		<link rel="stylesheet" href="<%=path%>/css/font-awesome.min.css" />
		<link rel="stylesheet" href="<%=path%>/css/amazeui.min.css" />
		<link rel="stylesheet" href="<%=path%>/css/admin.css" />
		<style>
		.search {
		    padding:10px 0;
		}
		#sform {
		    position:relative;
		    width:600px;
			margin-top: 10px;
			margin-bottom: 30px;
		}
		
		#search {
		    width:100%;
		    height:42px;
		    padding-left:13px;
			border-radius: 5px;
		}
		#btn_search {
		    height:42px;
		    width:80px;
		    cursor:pointer;
		    position:absolute;
		}     
		.bar #btn_search {
		    border:2px solid #4F99C6;
		    border-radius:5px;
		    background:transparent;
		    top:0;
		    right:0;
		}
		.bar #btn_search {
		    background:#4F99C6;
		    border-radius:0 5px 5px 0;
		    width:100px;
		    top:0;
		    right:0;
		}
		.bar #btn_search:before {
		    content:"搜索";
		    font-size:15px;
		    color:#F9F0DA;
		}
		</style>
	<body>
		<div class="dvcontent">

			<div>
				<!--tab start-->
				<div class="tabs">
					<div class="hd">
						<ul style="">
							<li style="box-sizing: initial;-webkit-box-sizing: initial;" class="on">教师管理</li>
							<li class="" style="box-sizing: initial;-webkit-box-sizing: initial;" ><a style="color:white; text-decoration: none;" href="<%=path%>/teacher/getAdd">添加教师</a></li>
						</ul>
					</div>
					
					<div class="bd">
						<ul style="display: block;padding: 20px;">
							<li>
								<!--分页显示角色信息 start-->
								<div id="dv1">
									<div class="search bar">
									<form id="sform" action="<%=path%>/teacher/search">
										<input placeholder="输入关键字查询" name="key" type="text" id="search" value="${key}">
										<button type="submit" id="btn_search"></button>
									</form>
									</div>
									<form action="<%=path%>/teacher/deleteItems" method="post" id="form1">
									<table class="table" id="tbRecord">
										<thead>
											<tr>
												<th><input type="checkbox" id="selectAll"> 全选/反选</th>
												<th>教师编号</th>
												<th>所属院系</th>
												<th>姓名</th>
												<th>性别</th>
												<th>年龄</th>
												<th>职称</th>
												<th>电话</th>
												<th>籍贯</th>
												<th>编辑</th>
												<th>删除</th>
											</tr>
										</thead>
										<c:forEach items="${info.list}" var="teacher">
										<tbody>
										<tr>
											<td><input type="checkbox" name="chkIds" value="${teacher.teacherId}"></td>
											<td>${teacher.teacherId}</td>
											<td>${teacher.college.collegeName}</td>
											<td>${teacher.teacherName}</td>
											<td>${teacher.sex}</td>
											<td>${teacher.age}</td>
											<td>${teacher.title}</td>
											<td>${teacher.teacherPhone}</td>
											<td>${teacher.address}</td>
											<td>
												<a href="<%=path%>/teacher/getOne?teacherId=${teacher.teacherId}">
													<span class="glyphicon glyphicon-edit" aria-hidden="true"><i class="icon-edit bigger-120"></i>编辑</span>
												</a>
											</td>
											<td>
												<a href="javascript:delTeacher(${teacher.teacherId}) ">
													<span class="glyphicon glyphicon-trash del" aria-hidden="true"><i class="icon-trash bigger-120"></i>删除</span>
												</a>
											</td>
										</tr>
										</c:forEach>
										<tr>
											<td colspan="11">
												<c:if test="${info.pageNum !=1}">
													<a href="<%=path%>/teacher/listAll?page=1&key=${key}">首页</a>
													<a href="<%=path%>/teacher/listAll?page=${info.prePage}&key=${key}">上一页</a>
												</c:if>
												<c:if test="${info.pageNum==1}">
													首页
													上一页
												</c:if>
												<c:forEach items="${info.navigatepageNums}" var="num">
													<c:if test="${num == info.pageNum}">
														【${num}】
													</c:if>
													<c:if test="${num != info.pageNum}">
														<a href="<%=path%>/teacher/listAll?page=${num}&key=${key}">${num}</a>
													</c:if>
												</c:forEach>
												<c:if test="${info.pageNum!=info.pages}">
													<a href="<%=path%>/teacher/listAll?page=${info.nextPage}&key=${key}">下一页</a>
													<a href="<%=path%>/teacher/listAll?page=${info.pages}&key=${key}">末页</a>
												</c:if>
												<c:if test="${info.pageNum == info.pages}">
													下一页
													末页
												</c:if>
											</td>
										</tr>
										</tbody>
									</table>
									<input  onclick="delAllTeacher()"  type="button" style="margin-left: 50%;color: white; padding: 4px; background-color:#D15B47;" id="delAll" class="icon-trash bigger-120" value="全部删除"/>
									</form>
								</div>
								<!--分页显示角色信息 end-->
							</li>
						</ul>
						<ul class="theme-popbod dform" style="display: none;">
							<div class="am-cf admin-main" style="padding-top: 0px;">
			<!-- content start -->
			
	<div class="am-cf admin-main" style="padding-top: 0px;">
		<!-- content start -->
		<div class="admin-content">
			<div class="admin-content-body">
				
				<div class="am-g">
					<div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">
						
					</div>
					<div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4"
						style="padding-top: 30px;">
						<form class="am-form am-form-horizontal"
							action="teacher.jsp">
						
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									所属院系</label>
									<div class="am-u-sm-9">
										<select name="groupId" required>
											<option value="">请选择分类</option>
											<option value=""  >信息工程学院</option>
											<option value="">人文学院</option>
										</select> 
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									姓名</label>
								<div class="am-u-sm-9">
									<input type="text" id="person" required
										 name="person">
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									性别</label>
								<div class="am-u-sm-9" style="line-height: 30px;">
									<input type="radio" name="sex" checked/> <label>
										男 </label> &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="sex"/>
									<label> 女 </label> <br />
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									年龄</label>
								<div class="am-u-sm-9">
									<input type="text" id="person" required
										 name="person">
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									职称</label>
								<div class="am-u-sm-9">
									<input type="text" id="person" required
										 name="person">
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									电话</label>
								<div class="am-u-sm-9">
									<input type="text" id="person" required
										 name="person">
								</div>
							</div>
							<div class="am-form-group">
								<label for="user-name" class="am-u-sm-3 am-form-label">
									籍贯</label>
								<div class="am-u-sm-9">
									<input type="text" id="person" required
										 name="person">
								</div>
							</div>
							<div class="am-form-group">
								<div class="am-u-sm-9 am-u-sm-push-3">
									<input type="submit" class="am-btn am-btn-success" style="margin-top: 30px; margin-left: 40%; margin-bottom: 10px;" value="提交" />
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		
		</div>
		<!-- content end -->
	</div>
							<!-- end-->
						</ul>
					</div>
				</div>
				<!--tab end-->

			</div>

			<script src="<%=path%>/js/jquery-3.6.0.js" type="text/javascript"></script>
			<script src="<%=path%>/js/jquery-1.7.2.min.js" type="text/javascript"></script>
			<script src="<%=path%>/js/plugs/Jqueryplugs.js" type="text/javascript"></script>
			<script src="<%=path%>/js/_layout.js"></script>
			<script src="<%=path%>/js/plugs/jquery.SuperSlide.source.js"></script>
			<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
			<script src="<%=path%>/js/jquery.min.js"></script>
			<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
			<script src="<%=path%>/js/bootstrap.min.js"></script>
			<script type="text/javascript" src="<%=path%>/js/alert.min.js"></script>
			<script>
                function delTeacher(teacherId) {
                    $.confirm('确认要删除吗？', function (isConfirm) {
                        if (isConfirm) {
                            //$.alert('确认');
                            window.location.href ="<%=path%>/teacher/delete?teacherId="+teacherId;
                        } else {
                            //$.alert('取消');
                        }
                    });
                }
                function delAllTeacher() {
                    $.confirm('确认要删除吗？', function (isConfirm) {
                        if (isConfirm) {
                            document.getElementById("form1").submit();
                        } else {
                            //$.alert('取消');
                        }
                    });
                }

                document.getElementById("selectAll").onclick=function(){
                    var cbs=document.getElementsByName("chkIds");
                    //遍历下面所有的选项
                    for(var i=0;i<cbs.length;i++){
                        //设置cbs[i].checked的状态与第一个firstcb.checked相同
                        cbs[i].checked=this.checked;
                    }
                }
			</script>
		</div>
	</body>

</html>